﻿<%@ Page Title="WDPA: Advanced Search Results" Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="MultiResult.aspx.cs" Inherits="Default2" %>

<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" Runat="Server">
<p class="PageTitle">
        <asp:Label CssClass="PageTitle" ID="LTitle" runat="server"></asp:Label></p>
    <asp:Label ID="LRecordsCount" runat="server" Font-Italic="true"></asp:Label>
    <br />
    <br />
    <div runat="server" id="divNatResults" align="center">
        <asp:Label ID="LNatAll" runat="server" Font-Bold="true" Visible="false" Text="National Results"></asp:Label>
        <br />
        <table width="700px" cellpadding="4" cellspacing="0" style="text-align: center; background-color: #284775;">
            <tr>
                <td>
                    <asp:Label ID="LAlphaFilterNat" ForeColor="White" Font-Bold="true" runat="server"
                        Text="Alphabetical Filter:"></asp:Label>&nbsp;
                    <asp:Repeater ID="NatAlphaRepeater" runat="server" DataSourceID="SqlDataSource3">
                        <ItemTemplate>
                            <asp:LinkButton ID="NatLBAlpha" runat="server" ForeColor="White" OnCommand="LBAlpha_Command"
                                CommandArgument='<%#Eval("Alpha") %>' CommandName="NatAlphaChoice" CausesValidation="false"><%#Eval("Alpha") %></asp:LinkButton>&nbsp;
                        </ItemTemplate>
                    </asp:Repeater>
                    &nbsp;<asp:LinkButton ID="LBNatAlphaAll" OnCommand="LBAlpha_Command" CommandName="NatAlphaAll"
                        ForeColor="White" runat="server" CausesValidation="false">Show all...</asp:LinkButton>
                </td>
            </tr>
        </table>
        <table width="700px" cellpadding="4" cellspacing="0" style="text-align: center; background-color: #F7F6F3;">
            <tr>
                <td>
                    <p style="color: Black;">
                        Display results per page:&nbsp;<asp:DropDownList ID="DDLNatPagingSize" runat="server"
                            AutoPostBack="true" OnSelectedIndexChanged="DDLAlphaPagingSize_SelectedIndexChanged">
                            <asp:ListItem Text="10" Value="10" />
                            <asp:ListItem Text="50" Value="50" />
                            <asp:ListItem Text="100" Value="100" />
                            <asp:ListItem Text="Max (1000)" Value="1000" />
                        </asp:DropDownList>
                    </p>
                </td>
            </tr>
        </table>
        <asp:GridView ID="GVNatResults" runat="server" AllowPaging="True" EnableViewState="true"
            AllowSorting="True" AutoGenerateColumns="False" DataSourceID="SqlDataSource1"
            CellPadding="4" ForeColor="#333333" EmptyDataText="There are no results that match your search criteria"
            GridLines="None" Width="700px" OnRowDataBound="GVNatResults_RowDataBound">
            <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
            <RowStyle BackColor="#F7F6F3" ForeColor="#333333" HorizontalAlign="Left" />
            <Columns>
                <asp:HyperLinkField DataNavigateUrlFields="Site_ID" DataNavigateUrlFormatString="default.aspx?#/pa/{0}"
                    DataTextField="English_Name" HeaderStyle-Font-Size="Small" HeaderText="Site Name"
                    SortExpression="English_Name">
                    <HeaderStyle HorizontalAlign="Left" />
                </asp:HyperLinkField>
                <asp:BoundField DataField="Designation" HeaderStyle-Font-Size="Small" HeaderText="National Designation"
                    SortExpression="Designation">
                    <HeaderStyle Font-Size="Small" HorizontalAlign="Left"></HeaderStyle>
                    <ItemStyle HorizontalAlign="Left" />
                </asp:BoundField>
                <asp:BoundField DataField="Country" HeaderStyle-Font-Size="Small" HeaderText="Country"
                    SortExpression="Country">
                    <HeaderStyle Font-Size="Small" HorizontalAlign="Left"></HeaderStyle>
                    <ItemStyle HorizontalAlign="Left" />
                </asp:BoundField>
                <%-- <asp:BoundField DataField="MPA" HeaderText="MPA" SortExpression="MPA" />--%>
                <asp:BoundField DataField="IUCNCategory" HeaderStyle-Font-Size="Small" HeaderText="IUCN"
                    SortExpression="IUCNCategory">
                    <HeaderStyle Font-Size="Small" HorizontalAlign="Left"></HeaderStyle>
                </asp:BoundField>
                <asp:BoundField DataField="MarineTerrestrial" HeaderStyle-Font-Size="Small" HeaderText="Marine or Terrestrial"
                    SortExpression="MarineTerrestrial">
                    <HeaderStyle Font-Size="Small" HorizontalAlign="Left"></HeaderStyle>
                </asp:BoundField>
                <asp:BoundField DataField="DocumentedTotalArea" HeaderStyle-Font-Size="Small" HeaderText="Total Area (ha)"
                    SortExpression="DocumentedTotalArea">
                    <HeaderStyle Font-Size="Small" HorizontalAlign="Left"></HeaderStyle>
                </asp:BoundField>
                <asp:BoundField DataField="DocumentedTotalMarineArea" HeaderStyle-Font-Size="Small"
                    HeaderText="Total Marine Area (ha)" SortExpression="DocumentedTotalMarineArea">
                    <HeaderStyle Font-Size="Small" HorizontalAlign="Left"></HeaderStyle>
                </asp:BoundField>
            </Columns>
            <PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
            <SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
            <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
            <EditRowStyle BackColor="#999999" />
            <AlternatingRowStyle BackColor="White" ForeColor="#284775" />
        </asp:GridView>
        <br />
    </div>
    <div runat="server" id="divIntResults" align="center">
        <asp:Label ID="LIntAll" runat="server" Font-Bold="true" Visible="false" Text="International Results"></asp:Label>
        <br />
        <table width="700px" cellpadding="4" cellspacing="0" style="text-align: center; background-color: #284775;">
            <tr>
                <td>
                    <asp:Label ID="LAlphaFilterInt" ForeColor="White" Font-Bold="true" runat="server"
                        Text="Alphabetical Filter:"></asp:Label>&nbsp;
                    <asp:Repeater ID="IntAlphaRepeater" runat="server" DataSourceID="SqlDataSource3">
                        <ItemTemplate>
                            <asp:LinkButton ID="IntLBAlpha" ForeColor="White" runat="server" OnCommand="LBAlpha_Command"
                                CommandArgument='<%#Eval("Alpha") %>' CommandName="IntAlphaChoice" CausesValidation="false"><%#Eval("Alpha") %></asp:LinkButton>&nbsp;
                        </ItemTemplate>
                    </asp:Repeater>
                    &nbsp;<asp:LinkButton ID="LBIntAlphaAll" OnCommand="LBAlpha_Command" CommandName="IntAlphaAll"
                        CausesValidation="false" ForeColor="White" runat="server">Show all...</asp:LinkButton>
                </td>
            </tr>
        </table>
        <table width="700px" cellpadding="4" cellspacing="0" style="text-align: center; background-color: #F7F6F3;">
            <tr>
                <td>
                    <p style="color: Black;">
                        Display results per page:&nbsp;<asp:DropDownList ID="DDLIntPagingSize" runat="server"
                            AutoPostBack="true" OnSelectedIndexChanged="DDLAlphaPagingSize_SelectedIndexChanged">
                            <asp:ListItem Text="10" Value="10" />
                            <asp:ListItem Text="50" Value="50" />
                            <asp:ListItem Text="100" Value="100" />
                            <asp:ListItem Text="Max (1000)" Value="1000" />
                        </asp:DropDownList>
                    </p>
                </td>
            </tr>
        </table>
        <asp:GridView ID="GVIntResults" runat="server" AllowPaging="True" AllowSorting="True"
            AutoGenerateColumns="False" CellPadding="4" DataSourceID="SqlDataSource2" ForeColor="#333333"
            EmptyDataText="There are no results that match your search criteria" GridLines="None"
            Width="700px" OnRowDataBound="GVIntResults_RowDataBound">
            <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
            <RowStyle BackColor="#F7F6F3" ForeColor="#333333" HorizontalAlign="Left" />
            <Columns>
                <asp:HyperLinkField DataNavigateUrlFields="Site_ID" DataNavigateUrlFormatString="default.aspx?#/pa/{0}"
                    DataTextField="English_Name" HeaderStyle-Font-Size="Small" HeaderText="Site Name"
                    SortExpression="English_Name">
                    <ItemStyle HorizontalAlign="Left" />
                    <HeaderStyle Font-Size="Small" HorizontalAlign="Left"></HeaderStyle>
                </asp:HyperLinkField>
                <asp:BoundField DataField="Convention" HeaderStyle-Font-Size="Small" HeaderText="Convention"
                    SortExpression="Convention">
                    <ItemStyle HorizontalAlign="Left" />
                    <HeaderStyle Font-Size="Small" HorizontalAlign="Left"></HeaderStyle>
                </asp:BoundField>
                <asp:BoundField DataField="Country" HeaderStyle-Font-Size="Small" HeaderText="Country"
                    SortExpression="Country">
                    <ItemStyle HorizontalAlign="Left" />
                    <HeaderStyle Font-Size="Small" HorizontalAlign="Left"></HeaderStyle>
                </asp:BoundField>
                <%-- <asp:BoundField DataField="MPA" HeaderText="MPA" SortExpression="MPA" />--%>
                <%--<asp:BoundField DataField="Criteria" HeaderStyle-Font-Size="Small" HeaderText="Criteria"
                    SortExpression="Criteria">
                    <ItemStyle HorizontalAlign="Left" />
                </asp:BoundField>--%>
                <asp:BoundField DataField="MarineTerrestrial" HeaderStyle-Font-Size="Small" HeaderText="Marine or Terrestrial"
                    SortExpression="MarineTerrestrial">
                    <ItemStyle HorizontalAlign="Left" />
                    <HeaderStyle Font-Size="Small" HorizontalAlign="Left"></HeaderStyle>
                </asp:BoundField>
                <asp:BoundField DataField="DocumentedTotalArea" HeaderStyle-Font-Size="Small" HeaderText="Total Area (ha)"
                    SortExpression="DocumentedTotalArea">
                    <HeaderStyle Font-Size="Small" HorizontalAlign="Left"></HeaderStyle>
                </asp:BoundField>
                <asp:BoundField DataField="DocumentedTotalMarineArea" HeaderStyle-Font-Size="Small"
                    HeaderText="Total Marine Area (ha)" SortExpression="DocumentedTotalMarineArea">
                    <HeaderStyle Font-Size="Small" HorizontalAlign="Left"></HeaderStyle>
                </asp:BoundField>
            </Columns>
            <PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
            <SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
            <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
            <EditRowStyle BackColor="#999999" />
            <AlternatingRowStyle BackColor="White" ForeColor="#284775" />
        </asp:GridView>
        <br />
    </div>
    <%--<div runat="server" id="divAllResults" style="clear: both; text-align: center;">
        <asp:GridView ID="GVAllResults" runat="server" AllowPaging="True" AllowSorting="True"
            AutoGenerateColumns="False" CellPadding="4" DataSourceID="SqlDataSource3" ForeColor="#333333"
            EmptyDataText="There are no results that match your search criteria" GridLines="None">
            <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
            <RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
            <Columns>
                <asp:BoundField DataField="IntNat" HeaderStyle-Font-Size="Small" HeaderText="National/International"
                    SortExpression="IntNat">
                    <ItemStyle HorizontalAlign="Left" />
                </asp:BoundField>
                <asp:HyperLinkField DataNavigateUrlFields="Site_ID" DataNavigateUrlFormatString="siteSheet.aspx?sitecode={0}"
                    DataTextField="English_Name" HeaderStyle-Font-Size="Small" HeaderText="Site Name" />
                <asp:BoundField DataField="Designation" HeaderText="Designation" SortExpression="Designation" />
                <asp:BoundField DataField="Convention" HeaderStyle-Font-Size="Small" HeaderText="Convention"
                    SortExpression="Convention" />
                <asp:BoundField DataField="IUCNCategory" HeaderStyle-Font-Size="Small" HeaderText="IUCN"
                    SortExpression="IUCNCategory" />
                <asp:BoundField DataField="Criteria" HeaderStyle-Font-Size="Small" HeaderText="Criteria"
                    SortExpression="Criteria" />
                <--  <asp:BoundField DataField="MPA" HeaderText="MPA" 
                            SortExpression="MPA" />-->
            </Columns>
            <PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
            <SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
            <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
            <EditRowStyle BackColor="#999999" />
            <AlternatingRowStyle BackColor="White" ForeColor="#284775" />
        </asp:GridView>
    </div>--%>
    <br />
    <fieldset runat="server" id="DownloadSection" visible="false" style="padding: 1em;
        margin: 1em;">
        <legend style="color: #192F6B; font-weight: bold;">Download</legend>
        <p runat="server" id="paraRegUser">
            To download these results, agree to our terms and conditions and fill in the simple
            form below.</p>
        <%--<p style="text-align:center; font-size:small;"><strong> Please note:  during the testing phase of <a href="Default.aspx">www.wdpa.org</a>, the download will be limited to 20 protected areas.</strong></p>    --%>
        <table width="650px" cellpadding="0" cellspacing="10" border="0">
            <tr>
                <td style="border: 1px solid #000000; text-align: center;">
                    <table cellpadding="5" cellspacing="0" border="0" style="width: 100%">
                        <tr>
                            <td class="HomepageBoxesTitleTD" width="100%">
                                Download Details:
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <div id="divProteusNo" runat="server">
                                    <div style="padding-top: 1em;">
                                        What is the primary use of this data?<asp:Label ID="Label1" runat="server" Text=" *"
                                            ForeColor="Red"></asp:Label>
                                        <asp:DropDownList ID="DataUse" runat="server">
                                            <asp:ListItem>Please select</asp:ListItem>
                                            <asp:ListItem>Commercial use</asp:ListItem>
                                            <asp:ListItem>Policy development</asp:ListItem>
                                            <asp:ListItem>Scientific research</asp:ListItem>
                                            <asp:ListItem>For teaching purposes</asp:ListItem>
                                            <asp:ListItem>Field application</asp:ListItem>
                                            <asp:ListItem>To assist in the fulfillment of operational or CSR obligations</asp:ListItem>
                                            <asp:ListItem>Out of interest</asp:ListItem>
                                            <asp:ListItem>Other</asp:ListItem>
                                        </asp:DropDownList>
                                        <br />
                                        <p style="color: Red;">
                                            <strong>Please note that permission to use the WDPA for commercial purposes will not
                                                be unreasonably withheld
                                                <br />
                                                - to discuss your needs please send an email to: <a href="mailto:wdpacommercial@unep-wcmc.org">
                                                    wdpacommercial@unep-wcmc.org</a></strong></p>
                                        <div id="scroll_box" class="scroll_box" runat="server">
                                        </div>
                                        <asp:Label ID="Label2" runat="server" Text="I have read and accept the Terms and Conditions and understand the data is NOT to be used for commercial purpose without permission"></asp:Label>
                                        <asp:CheckBox ID="AgreetoTandC" runat="server" AutoPostBack="True" BackColor="Green"
                                            OnCheckedChanged="AgreetoTandC_CheckedChanged1" />
                                    </div>
                                </div>
                                <br />
                                <asp:Button ID="downloadSubmit" runat="server" Text="Download" Enabled="False" OnClick="BtnDownloadShp_Click"
                                    CausesValidation="true" />
                                <br />
                                <asp:RequiredFieldValidator ID="ReqValDataUse" runat="server" InitialValue="Please select"
                                    ControlToValidate="DataUse" ErrorMessage="Please choose a data use"></asp:RequiredFieldValidator>
                            </td>
                        </tr>
                    </table>
                </td>
            </tr>
        </table>
    </fieldset>
    <fieldset runat="server" id="DownloadReady" visible="false" style="padding: 1em;
        margin: 1em; text-align: center;">
        <legend style="color: #192F6B; font-weight: bold;">Download</legend>
        <table width="650px" cellpadding="0" cellspacing="10" border="0" style="text-align: center;">
            <tr>
                <td style="border: 1px solid #000000; text-align: center;">
                    <table cellpadding="5" cellspacing="0" border="0" style="width: 100%">
                        <tr>
                            <td class="HomepageBoxesTitleTD" width="100%">
                                Link to Download
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <div>
                                    <p>
                                        Your download request has been placed in the queue and will be processed as soon
                                        as possible. Once complete you will find a link to your files in the download area.
                                    </p>
                                    <p>
                                        <asp:Button ID="btnGoToDownloads" OnClick="btnGoToDownloads_Click" runat="server"
                                            Text="View Downloads" />
                                        <%--<asp:ImageButton ID="ImageButton1" runat="server" ImageUrl="~/images/BtnEx1.png"
                                            PostBackUrl="~/Download.aspx" />--%></p>
                                </div>
                            </td>
                        </tr>
                    </table>
                </td>
            </tr>
        </table>
    </fieldset>
    <%-- <asp:BoundField DataField="MPA" HeaderText="MPA" SortExpression="MPA" />--%>
    <%-- <asp:BoundField DataField="MPA" HeaderText="MPA" SortExpression="MPA" />--%>
    <!-- Data Sources -->
    <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:WDPAConnectionString1 %>">
    </asp:SqlDataSource>
    <asp:SqlDataSource ID="SqlDataSource2" runat="server" ConnectionString="<%$ ConnectionStrings:WDPAConnectionString1 %>">
    </asp:SqlDataSource>
    <asp:Button ID="BtnDownloadShp" runat="server" OnClick="BtnDownloadShp_Click" Text="Export to Shapefile"
        Visible="False" />
    <asp:SqlDataSource ID="SqlDataSource3" runat="server" ConnectionString="<%$ ConnectionStrings:WDPAConnectionString1 %>">
    </asp:SqlDataSource>
    <!-- -->
</asp:Content>

